<%@ include file="partials/init.jsp" %>
<%
if ("POST".equals(request.getMethod())) {	
	String userEmail = request.getParameter("userEmail").trim();
	String userPassword = request.getParameter("userPassword").trim();
	
	if (!User.login(userEmail, userPassword)) {
		session = request.getSession(true);
		User u = new User();
		session.setAttribute("user_data", u);
		User b = (User) session.getAttribute("user_data");
		feedbackMsg = (String) UIFeedback.GetMsg("login_fail");
		
	}else {
		response.sendRedirect("home.jsp?msg=login_ok");
		// redirect user to post.jsp
	}
}
%>	
			
<%@ include file="partials/header.jsp" %>
			<div class="main">
			<div class="center">				
			<% out.println(feedbackMsg); %>
			
			<form name="register" method="post" enctype="application/x-www-form-urlencoded" action="login.jsp">
			<fieldset style="background:#EFEFEF;">	
			<p style="font-weight: bold;">Login</p>
			<p><label style="float:left;width:150px;">User Email</label><input name="userEmail" type="text"  /></p>
			<p><label style="float:left;width:150px;">Password</label><input name="userPassword" type="password"  /></p>
			
			<input type="submit" name="submit" value="Login" />
			</fieldset>	
			</form>			
			</div>
			</div>
<%@ include file="partials/footer.jsp" %>	